package com.neusoft.databus.common.utils;

import org.apache.commons.jexl3.JexlBuilder;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.JexlEngine;
import org.apache.commons.jexl3.JexlExpression;

public class JexlUtil {
    public static JexlEngine jexlEngine = new JexlBuilder().create();

    public static JexlExpression createExpression(String expression) {
        return JexlUtil.jexlEngine.createExpression(expression);
    }

    public static Object evaluate(String expression, JexlContext ctx) {
        return JexlUtil.jexlEngine.createExpression(expression).evaluate(ctx);
    }
}
